package com.shunhe.storage.ui.repo;

import android.content.Context;
import android.os.Bundle;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.ruitu.arad.base.BaseActivity;
import com.ruitu.arad.base.base_list.ListBaseAdapter;
import com.ruitu.arad.base.base_list.SuperViewHolder;
import com.ruitu.router_module.support.view.LinearItemDecoration;
import com.shunhe.storage.R;
import com.shunhe.storage.dao.model.Goods;

import java.util.ArrayList;
import java.util.List;

// 入库单详情
public class InRepoDetailActivity extends BaseActivity {
    private RecyclerView rcv_list;

    private GoodsListAdapter adapter;
    private List<Goods> goodsList = new ArrayList<>();

    @Override
    protected int getLayoutRes() {
        return R.layout.activity_in_repo_detail;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        rcv_list = findViewById(R.id.rcv_list);

        setHeadTitle("入库单");

        LinearLayoutManager manager = new LinearLayoutManager(this);
        adapter = new GoodsListAdapter(this);
        LinearItemDecoration divider = new LinearItemDecoration.Builder(this)
                .setSpan(R.dimen.deco_10_dp)
                .setColorResource(R.color.divider_list)
                .setShowLastLine(true)
                .build();
        rcv_list.addItemDecoration(divider);
        rcv_list.setLayoutManager(manager);
        rcv_list.setAdapter(adapter);

        for (int i = 0; i < 5; i++) {
            goodsList.add(new Goods());
        }
        adapter.setDataList(goodsList);

        setListeners();

    }

    private void setListeners() {
        setOnClickListener();
    }

    private class GoodsListAdapter extends ListBaseAdapter<Goods> {

        public GoodsListAdapter(Context context) {
            super(context);
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_goods_list_in_repo_detail;
        }

        @Override
        public void onBindItemHolder(SuperViewHolder holder, int position) {

        }
    }
}